package com.ctvit.framework.excel;

import java.util.AbstractList;
import java.util.List;
import java.util.Map;

import org.apache.commons.beanutils.PropertyUtils;


public class PrintList extends AbstractList{
	private List values;
	private String key;
	public PrintList(List values,String key){
		this.values=values;
		this.key=key;
	}
	public Object get(int index) {
		Object value=values.get(index);
		if(value instanceof Map){
			return ((Map)value).get(key);
		}else{
			try {
				return PropertyUtils.getProperty(value, key);
			} catch (Exception e) {
				return null;
			}
		}
	}

	public int size() {
		return values.size();
	}
}
